package com.tbit.uqbike.webmanager.controller;

import com.tbit.uqbike.object.pojo.vo.DownloadHistoryVO;
import com.tbit.common.entity.view.PageResult;
import com.tbit.common.entity.view.Result;
import com.tbit.uqbike.service.business.DownloadHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * 下载历史
 *
 * @AUTHOR: wei.xing
 * @DATE: 2022-11-11 14:16
 **/
@RestController
@RequestMapping("/downloadHistory")
public class DownloadHistoryController {


    @Autowired
    DownloadHistoryService service;

    /**
     * 获取下载历史的分页
     *
     * @param operatorName  姓名
     * @param operatorPhone 手机号
     * @param startTime     开始时间
     * @param endTime       结束时间
     * @param pageNO        页码
     * @param rowCount      每页条数
     * @return
     */
    @GetMapping("/page")
    public Result<PageResult<DownloadHistoryVO>> page(String operatorPhone, String operatorName, Date startTime, Date endTime, Integer pageNO, Integer rowCount) {
        PageResult<DownloadHistoryVO> pageResult = service.page(operatorPhone, operatorName, startTime, endTime, pageNO, rowCount);
        return Result.success(pageResult);
    }


    /**
     * 通过id删除
     *
     * @param id
     * @return
     */
    @GetMapping("/del/{id}")
    public Result del(@PathVariable(value = "id") Long id) {
        service.del(id);
        return Result.success();
    }


}
